package composite.collegeDisplay.component;

import composite.collegeDisplay.component.base.OrganizationComponent;

import java.util.ArrayList;

public class University extends OrganizationComponent {

    private ArrayList<OrganizationComponent> colleges;

    public University(String name, String desc) {
        super(name, desc);
        colleges = new ArrayList<OrganizationComponent>();
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        colleges.add(organizationComponent);
    }

    @Override
    public void remove(OrganizationComponent organizationComponent) {
        colleges.remove(organizationComponent);
    }

    @Override
    public void print() {
        System.out.println("====="+ this.getName() +"=====");
        for (OrganizationComponent college : colleges) {
            college.print();
        }
    }
}
